Skip to content

Comments

Fix config precedence: respect local configuration in multi-blueprint workflows#170

Merged
sellakumaran merged 3 commits intomainfrom
copilot/fix-a365-cli-config-issue
Feb 7, 2026
Merged

Fix config precedence: respect local configuration in multi-blueprint workflows#170
sellakumaran merged 3 commits intomainfrom
copilot/fix-a365-cli-config-issue

Conversation

Copy link
Contributor

Copilot AI commented Jan 22, 2026

Problem

SaveStateAsync unconditionally synced to global directory (%LOCALAPPDATA%\Microsoft.Agents.A365.DevTools.Cli), causing state from different projects to overwrite each other. Users working with multiple blueprints had to manually delete global config between context switches.

Changes

Modified ConfigService.SaveStateAsync() to enforce proper precedence:

  • Project directories (containing a365.config.json): Save state locally only, no global sync
  • Non-project directories: Save to global for CLI portability
  • Absolute paths: Use as-is for explicit control

Implementation

// Check for local static config presence
var staticConfigPath = Path.Combine(Environment.CurrentDirectory, ConfigConstants.DefaultConfigFileName);
bool hasLocalStaticConfig = File.Exists(staticConfigPath);

if (hasLocalStaticConfig)
{
    // Project directory - local state only
    await File.WriteAllTextAsync(currentDirPath, json);
}
else
{
    // Non-project - global for portability
    await SyncConfigToGlobalDirectoryAsync(statePath, json);
}

Tests

Added verification for:

  • Local-only save when static config exists
  • Global save when no local config present
  • No cross-contamination between projects

Impact

Enables independent configuration per project without manual cleanup. Global directory now serves its intended purpose: portability for non-project CLI invocations.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • graph.microsoft.com
    • Triggering command: /usr/bin/../../opt/az/bin/python3 /usr/bin/../../opt/az/bin/python3 -Im azure.cli rest --method GET --url REDACTED$filter=appId eq 'a1b2c3d4-e5f6-a7b8-c9d0-e1f2a3b4c5d6'&$select=id --headers Authorization=Bearer fake-token-123 (dns block)
    • Triggering command: /usr/bin/../../opt/az/bin/python3 /usr/bin/../../opt/az/bin/python3 -Im azure.cli rest --method GET --url REDACTED$filter=appId eq 'a1b2c3d4-e5f6-a7b8-c9d0-e1f2a3b4c5d6'&$select=id --headers Authorization=Bearer fake-token-123 e.cs ator.cs e.cs�� Locator.cs onsoleFormatter.cs (dns block)
    • Triggering command: /usr/bin/../../opt/az/bin/python3 /usr/bin/../../opt/az/bin/python3 -Im azure.cli rest --method PATCH --url REDACTED --headers Content-Type=application/json Authorization=Bearer fake-token-123 --body {"publicClient":{"redirectUris":["http://localhost","http://localhost:8400/","ms-appx-web://microsoft.aad.brokerplugin/a1b2c3d4-e5f6-a7b8-c9d0-e1f2a3b4c5d6"]}} (dns block)
  • login.microsoftonline.com
    • Triggering command: /usr/bin/../../opt/az/bin/python3 /usr/bin/../../opt/az/bin/python3 -Im azure.cli login --tenant 12345678-1234-1234-1234-123456789012 (dns block)
    • Triggering command: `/usr/bin/../../opt/az/bin/python3 /usr/bin/../../opt/az/bin/python3 -Im azure.cli login --tenant 12345678-1234-1234-1234-123456789012 s global

Co-authored-by: sellakumaran <147754920+sellakumaran@users.noreply.github.com> = get && echo "password=$GITHUB_TOKEN"; }; f` (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>a365 CLI does not respect local configration when trying to create multiple blueprints</issue_title>
<issue_description>Once A365 CLI creates a blueprint, its storing a config file in %LOCALAPPDATA%\Microsoft.Agents.A365.DevTools.Cli.
if I change my local config, or create a separate config in another directory via copy and modify, it ignores my local settings and config file and attempts to use the one in the %LOCALAPPDATA%\Microsoft.Agents.A365.DevTools.Cli directory.

In order to create a 2 blueprints on the same machine and be able to work with them, I must delete the content of the %LOCALAPPDATA%\Microsoft.Agents.A365.DevTools.Cli each time I switch contexts.

Would recommend using %LOCALAPPDATA%\Microsoft.Agents.A365.DevTools.Cli only for token cache \ logs and remove all other configuration writing from there to allow the developer to manage configurations in the file system directly. </issue_description>

<agent_instructions>Can you please review the code base for this issue?

We already have fixed this issue in the past and maybe there are some cases that are not fixed fully yet.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@sellakumaran Thank you @MattB-msft for reporting the issue. The local config should always override the LOCALAPPDATA version. I will take a look at the issue and get back.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 22, 2026 01:01
Co-authored-by: sellakumaran <147754920+sellakumaran@users.noreply.github.com>
Co-authored-by: sellakumaran <147754920+sellakumaran@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix A365 CLI to respect local configuration for blueprints Fix config precedence: respect local configuration in multi-blueprint workflows Jan 22, 2026
Copilot AI requested a review from sellakumaran January 22, 2026 01:12
@sellakumaran sellakumaran marked this pull request as ready for review January 23, 2026 23:25
@sellakumaran sellakumaran requested review from a team as code owners January 23, 2026 23:25
Copilot AI review requested due to automatic review settings January 23, 2026 23:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes a critical configuration precedence issue where the CLI was unconditionally syncing state to the global directory, causing configuration from different projects to overwrite each other. The fix modifies ConfigService.SaveStateAsync() to enforce proper precedence by saving state locally when in a project directory (identified by the presence of a365.config.json) and only using the global directory when running outside a project context.

Changes:

  • Modified SaveStateAsync to check for local static config presence before deciding where to save state
  • Added logic to save state locally only when in a project directory, preventing cross-contamination
  • Added two comprehensive tests verifying local-only and global-only save behavior

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/Microsoft.Agents.A365.DevTools.Cli/Services/ConfigService.cs Implemented conditional save logic based on presence of local static config file
src/Tests/Microsoft.Agents.A365.DevTools.Cli.Tests/Services/Agent365ConfigServiceTests.cs Added tests for local-only save (with static config) and global-only save (without static config)

@sellakumaran sellakumaran merged commit 35a4cfb into main Feb 7, 2026
12 checks passed
@sellakumaran sellakumaran deleted the copilot/fix-a365-cli-config-issue branch February 7, 2026 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

a365 CLI does not respect local configration when trying to create multiple blueprints

4 participants